package cn.le.beans.dto;

import cn.le.utils.AnalysisSql;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.util.StringUtils;

/**
 * @Description
 * @Author le
 * @Date 2020/2/26 12:53
 * @Version 0.1
 **/
@Data
@ApiModel(value = "分页")
public class BasePage implements AnalysisSql {

    @ApiModelProperty(value = "页码")
    private Integer pageNum = 0;

    @ApiModelProperty(value = "分页大小")
    private Integer pageSize = 5;

    @ApiModelProperty(value = "排序")
    private String order;

    public String getOrder(){
        if (StringUtils.isEmpty(order)){
            return " order by create_date desc";
        }
        return " order by " + order;
    }
}
